<?php
namespace App\controllers;

use Core\http\Request;
use Core\http\Response;
use Core\annotations\Bean;
use Core\annotations\Value;
use Core\annotations\RequestMapping;

/**
 * @Bean(name="user")
 */
class UserController{

    /**
     * @Value(name="version")
     */
    public $version;

    /**
     * @RequestMapping(value="/test")
     */
    public function test(){
        return "abcd";
    }
    /**
     * @RequestMapping(value="/user")
     */
    public function user(Request $request,Response $response){
        // $response->htmlWrite("中国");
        $response->redirect("https://www.baidu.com");
        return "shenyi";
    }
    /**
     * @RequestMapping(value="/getUser/{uid:\d+}")  uid与参数名要一致
     *
     * @return void
     */
    public function getUser(Request $request,$uid,Response $response){
        // print_r($request->getQueryParams());
        // print_r($response);
        return [$uid];
    }


}